/*
 *  UI_Frame.h
 *
 *	Date: 2011-4-24
 *  Author: linshenqi
 */

#include "stdafx.h"
#include "./UI_Frame.h"

UI_Main::UI_Main(const CRect *pRect, const GRAPHICPROP *pProp)
: GraphicBase(pRect, pProp)
{}

UI_Main::~UI_Main()
{}

void UI_Main::SetRect(const CRect *pRect)
{
	GraphicBase::SetRect(pRect);
}

void UI_Main::SetProp(const GRAPHICPROP *pProp)
{
	GraphicBase::SetProp(pProp);
}

bool UI_Main::OnPaint(CPaintDC *pDC, CDC *pMemDC)
{
	CPaintDC dc(this->m_pWnd);
	this->SetDC(&dc);
	this->DrawRect(this->m_pRect, this->m_pProp);

	GraphicBase::OnPaint();
	return true;
}

 bool UI_Main::OnLButtonDown(UINT nFlags, CPoint point)
 {
	 this->SetDC(this->m_pWnd->GetDC());
	 GRAPHICPROP prop;
	 prop.clrFill = RGB(0, 255, 0);
	 this->SetProp(&prop);
	 this->DrawRect(this->m_pRect, this->m_pProp);
	 GraphicBase::OnLButtonDown(nFlags, point);
	 this->m_pWnd->ReleaseDC(this->m_pDC);
	 return true;
 }

 bool UI_Main::OnLButtonUp(UINT nFlags, CPoint point)
 {
	 this->SetDC(this->m_pWnd->GetDC());
	 GRAPHICPROP prop;
	 prop.clrFill = RGB(0, 255, 255);
	 this->SetProp(&prop);
	 this->DrawRect(this->m_pRect, this->m_pProp);
	 GraphicBase::OnLButtonUp(nFlags, point);
	 this->m_pWnd->ReleaseDC(this->m_pDC);
	 return true;
 }

 bool UI_Main::OnMouseMove(UINT nFlags, CPoint point)
 {
	 this->DrawRect(this->m_pRect, this->m_pProp, NULL, NULL, REDRAW);
	 return true;
 }